import request from '@/utils/request'

export function fetchProjectList() {
  return request({
    url: '/projects',
    method: 'get'
  })
}

export function fetchProjectId() {
  return request({
    url: '/projects/projectid',
    method: 'get'
  })
}

export function fetchProjectMidCheckList() {
  return request({
    url: '/projects/mid',
    method: 'get'
  })
}
export function fetchProjectSubjectCheckList() {
  return request({
    url: '/projects/subject',
    method: 'get'
  })
}
export function fetchProjectFinalCheckList() {
  return request({
    url: '/projects/final',
    method: 'get'
  })
}

export function fetchNotifiedProjectList() {
  return request({
    url: '/projects/notification',
    method: 'get'
  })
}

export function fetchProjectById(id) {
  return request({
    url: `/projects/${id}`,
    method: 'get'
  })
}

export function fetchProjectByProjectId(projectId) {
  return request({
    url: `/projects/${projectId}`,
    method: 'get'
  })
}

export function fetchProjectsByStatus(status) {
    return request({
      url: `/projects/status/${status}`,
      method: 'get'
    })
  }

export function fetchProjectsByOwnerId(ownerId) {
    return request({
      url: `/projects/ownby/${ownerId}`,
      method: 'get'
    })
  }


export function fetchProjectsByGroupId(projectGroupId) {
    return request({
      url: `/projects/group/${projectGroupId}`,
      method: 'get'
    })
  }

export function fetchProjectsByUserId(userId) {
    return request({
      url: `/projects/my/${userId}`,
      method: 'get'
    })
  }

export function createProject(data) {
  return request({
    url: '/projects',
    method: 'post',
    data
  })
}

export function updateProject(id, data) {
  return request({
    url: `/projects/${id}`,
    method: 'put',
    data
  })
}

export function updateProjectApprove(id, data) {
  return request({
    url: `/projects/approve/${id}`,
    method: 'put',
    data
  })
}

export function deleteProject(id) {
    return request({
      url: `/projects/${id}`,
      method: 'delete'
    })
}
